﻿// using System;
// using System.Runtime.InteropServices;

// namespace invokedll {
//     class Program {

//         [DllImport (@"D:\Desktops\C++\Dll2\x64\Debug\Dll2.dll", EntryPoint = "UpdateCameraSetting")]
//         public static extern void UpdateCameraSetting (ref Camera camera, ref CameraSetting cameraSetting);

//         [DllImport (@"D:\Desktops\C++\Dll2\x64\Debug\Dll2.dll", EntryPoint = "GetCameraImageData")]
//         public static extern int GetCameraImageData (ref CameraImageData cameraImageData);

//         [DllImport (@"D:\Desktops\C++\Dll2\x64\Debug\Dll2.dll", EntryPoint = "Add")]
//         public static extern int Add (ref Superman superman, int a, int b);

//         [DllImport (@"D:\Desktops\C++\Dll2\x64\Debug\Dll2.dll", EntryPoint = "Mul")]
//         public static extern int Mul (ref Superman superman, int a, int b);

//         [DllImport (@"D:\Desktops\C++\Dll2\x64\Debug\Dll2.dll", EntryPoint = "Print")]
//         public static extern void Print (ref Superman superman);

//         ///Console.WriteLine (Super.Add (1, 2));
//         static void Main (string[] args) {

//             ///     
//             Camera camera = new Camera ();
//             camera.CameraId = 1;
//             camera.CameraName = "sunme";

//             CameraSetting cameraSetting1 = new CameraSetting ();
//             cameraSetting1.Setting1 = 10;
//             cameraSetting1.Setting2 = true;
//             cameraSetting1.Setting3 = "MySetting001";

//             UpdateCameraSetting (ref camera, ref cameraSetting1);

//             CameraImageData cameraImageData = new CameraImageData ();
//             Console.WriteLine (GetCameraImageData (ref cameraImageData));

//             Superman s = new Superman ();

//             Console.WriteLine (Add (ref s, 200, 300000));
//             Console.WriteLine (Mul (ref s, 150, 200));
//             Print (ref s);
//         }

//         [System.Runtime.InteropServices.StructLayout (LayoutKind.Sequential)]
//         public struct Camera {
//             public int CameraId;
//             public CameraSetting Setting;
//             [System.Runtime.InteropServices.MarshalAs (UnmanagedType.ByValTStr, SizeConst = 20)]
//             public string CameraName;
//         }

//         [System.Runtime.InteropServices.StructLayout (LayoutKind.Sequential)]
//         public struct CameraSetting {
//             public int Setting1;
//             public bool Setting2;
//             [System.Runtime.InteropServices.MarshalAs (UnmanagedType.ByValTStr, SizeConst = 20)]
//             public string Setting3;
//         }

//         [System.Runtime.InteropServices.StructLayout (LayoutKind.Sequential)]
//         public struct CameraImageData {
//             public int CameraId;
//             [System.Runtime.InteropServices.MarshalAs (UnmanagedType.ByValTStr, SizeConst = 20)]
//             public string CameraName;
//             [System.Runtime.InteropServices.MarshalAs (UnmanagedType.ByValArray, SizeConst = 50000)]
//             public byte[] Image;
//             public CameraSetting Setting;
//         };
//         [System.Runtime.InteropServices.StructLayout (LayoutKind.Sequential)]
//         public class Superman {

//         }
//     }
// }